<template>
    <div class="Invite">
        <TopBar class="aa" :title='`"马甲线"的相关用户(${count})`' :url="'/index/my'"></TopBar>
        <div class="bottom">
            <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
            <van-list
                v-model="loading"
                :finished="finished"
                finished-text="没有更多了"
                @load="onLoad"
            >
            <Users v-for="item in list"></Users>
            </van-list>
            </van-pull-refresh>
        </div>
    </div>
</template>

<script>
    import TopBar from "../../component/TopBar";
    import Users from "./Users";
    import Vue from 'vue';
    import { List , PullRefresh } from 'vant';

    Vue.use(List);
    Vue.use(PullRefresh);
    export default {
        name: "Invite",
        components:{
            TopBar,
            Users
        },
        data(){
            return{
                count:16,
                list:[],
                loading: false,
                finished: false,
                refreshing: false,
            }
        },
        methods:{
            
            onLoad() {
      setTimeout(() => {
        if (this.refreshing) {
          this.list = [];
          this.refreshing = false;
        }

        for (let i = 0; i < 20; i++) {
          this.list.push(this.list.length + 1);
        }
        this.loading = false;

        if (this.list.length >= 40) {
          this.finished = true;
        }
      }, 1000);
    },
    onRefresh() {
      // 清空列表数据
      this.finished = false;

      // 重新加载数据
      // 将 loading 设置为 true，表示处于加载状态
      this.loading = true;
      this.onLoad();
    },
    clickHandle(){
    this.$router.push("/my/myCourse");
  }
        }
    }
</script>

<style lang="stylus" scoped>
    .Invite
        .bottom
            padding 0.15rem
            
        .middle
            padding 0.15rem 0 0 0.15rem
            h2
                font-weight 600
        .aa
            padding 0.3rem 0 0 0.2rem

            .img
                height 3rem
                width 100%
                background url("../../assets/img/invite.svg") no-repeat
                background-size 100%
                margin-top 0.7rem


</style>